package com.ruibo.config;

import com.ruibo.constants.RuiBoConstant;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
@ConfigurationProperties(prefix = "file")
public class FileProperties {

    /** 文件大小限制 */
    private Long maxSize;

    private RuiBoPath mac;

    private RuiBoPath linux;

    private RuiBoPath windows;

    public RuiBoPath getPath(){
        String os = System.getProperty("os.name");
        if(os.toLowerCase().startsWith(RuiBoConstant.WIN)) {
            return windows;
        } else if(os.toLowerCase().startsWith(RuiBoConstant.MAC)){
            return mac;
        }
        return linux;
    }

    /**
     *  可添加不同的路径
     */
    @Data
    public static class RuiBoPath{

        private String path;

        private String zipPath;

    }
}
